package com.pl.service.impl;

import com.pl.entity.Repairaddr;
import com.pl.dao.RepairaddrDao;
import com.pl.service.RepairaddrService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
/**
 * (Repairaddr)表服务实现类
 *
 * @author makejava
 * @since 2024-05-04 19:47:36
 */
@Service("repairaddrService")
public class RepairaddrServiceImpl implements RepairaddrService {
    @Autowired
    private RepairaddrDao repairaddrDao;

    /**
     * 通过ID查询单条数据
     *
     * @param addrId 主键
     * @return 实例对象
     */
    @Override
    public Repairaddr queryById(Integer addrId) {
        return this.repairaddrDao.queryById(addrId);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<Repairaddr> queryByPage(Integer pageNum) {
        return this.repairaddrDao.queryAllByLimit();
    }

    /**
     * 新增数据
     *
     * @param repairaddr 实例对象
     * @return 实例对象
     */
    @Override
    public Repairaddr insert(Repairaddr repairaddr) {
        this.repairaddrDao.insert(repairaddr);
        return repairaddr;
    }

    /**
     * 修改数据
     *
     * @param repairaddr 实例对象
     * @return 实例对象
     */
    @Override
    public Repairaddr update(Repairaddr repairaddr) {
        this.repairaddrDao.update(repairaddr);
        return this.queryById(repairaddr.getAddrId());
    }

    /**
     * 通过主键删除数据
     *
     * @param addrId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer addrId) {
        return this.repairaddrDao.deleteById(addrId) > 0;
    }

    @Override
    public List<Repairaddr> findByMap(HashMap<String, Object> map) {
        return repairaddrDao.findByMap(map);
    }

    @Override
    public int deleteByList(List<Integer> list) {
        return repairaddrDao.deleteByList(list);
    }
}
